/**
 * 定点数数学库查找表
 * 包含预计算的三角函数值，确保帧同步时计算的一致性
 */
export const FixedMathLut = {
    /**
     * 正弦查找表 - 0到359度
     * 使用16位定点数格式存储
     */
    SIN_TABLE: [
        0, 1143, 2287, 3429, 4571, 5711, 6850, 7986, 9120, 10252, 11380, 12504, 13625, 14742, 15854, 16961,
        18064, 19160, 20251, 21336, 22414, 23486, 24550, 25606, 26655, 27696, 28729, 29752, 30767, 31772, 32768, 33753,
        34728, 35693, 36647, 37589, 38521, 39440, 40347, 41243, 42125, 42995, 43852, 44695, 45525, 46340, 47142, 47929,
        48702, 49460, 50203, 50931, 51643, 52339, 53019, 53683, 54331, 54962, 55576, 56173, 56753, 57316, 57861, 58389,
        58898, 59390, 59863, 60317, 60753, 61170, 61568, 61947, 62308, 62648, 62970, 63272, 63554, 63817, 64060, 64283,
        64486, 64670, 64833, 64976, 65099, 65201, 65283, 65345, 65386, 65407, 65408, 65388, 65348, 65287, 65206, 65105,
        64984, 64842, 64680, 64499, 64297, 64076, 63835, 63575, 63296, 62997, 62679, 62343, 61986, 61612, 61218, 60805,
        60375, 59925, 59458, 58972, 58468, 57946, 57407, 56851, 56277, 55685, 55078, 54453, 53812, 53155, 52482, 51793,
        51089, 50369, 49635, 48886, 48123, 47345, 46554, 45749, 44930, 44097, 43252, 42395, 41525, 40643, 39749, 38843,
        37927, 36999, 36061, 35113, 34156, 33189, 32214, 31230, 30238, 29239, 28233, 27220, 26201, 25176, 24145, 23109,
        22068, 21023, 19974, 18921, 17865, 16807, 15746, 14683, 13619, 12553, 11487, 10421, 9355, 8290, 7226, 6164,
        5104, 4046, 2990, 1937, 886, -163, -1210, -2255, -3299, -4340, -5378, -6413, -7444, -8472, -9496, -10515,
        -11529, -12537, -13540, -14537, -15528, -16513, -17490, -18460, -19422, -20376, -21321, -22258, -23185, -24103, -25011, -25909,
        -26797, -27675, -28541, -29396, -30240, -31072, -31891, -32698, -33492, -34274, -35042, -35797, -36537, -37265, -37978, -38676,
        -39360, -40028, -40680, -41317, -41937, -42540, -43127, -43697, -44251, -44786, -45304, -45805, -46287, -46751, -47198, -47626,
        -48035, -48425, -48796, -49148, -49481, -49795, -50089, -50363, -50618, -50853, -51068, -51263, -51437, -51592, -51727, -51840,
        -51934, -52007, -52059, -52091, -52102, -52093, -52063, -52012, -51941, -51850, -51738, -51606, -51453, -51280, -51087, -50874,
        -50641, -50388, -50114, -49822, -49509, -49177, -48826, -48456, -48067, -47658, -47232, -46786, -46322, -45840, -45340, -44822,
        -44287, -43734, -43164, -42578, -41974, -41355, -40719, -40067, -39400, -38717, -38019, -37306, -36579, -35838, -35083, -34315,
        -33534, -32740, -31934, -31116, -30287, -29447, -28596, -27734, -26863, -25981, -25091, -24191, -23282, -22366, -21442, -20510,
        -19571, -18626, -17675, -16718, -15756, -14790, -13819, -12844, -11867, -10886, -9904, -8919, -7934, -6947, -5960, -4973,
        -3987, -3001, -2017, -1035, -55, 926, 1904, 2881, 3855, 4827, 5795, 6759, 7720, 8675, 9626, 10571,
        11510, 12443, 13370, 14289, 15201, 16105, 17000, 17887, 18764, 19632, 20490, 21338, 22174, 22999, 23813, 24615,
        25404, 26180, 26944, 27693, 28429, 29151, 29857, 30549, 31226, 31887, 32532, 33160, 33772, 34366, 34944, 35503,
        36045, 36569, 37075, 37561, 38030, 38479, 38909, 39320, 39710, 40081, 40432, 40762, 41073, 41362, 41630, 41878,
        42105, 42311, 42495, 42658, 42799, 42919, 43017, 43094, 43149, 43182, 43193, 43182, 43150, 43095, 43019, 42921
    ],

    /**
     * 正切查找表 - 0到359度
     * 使用16位定点数格式存储，特殊值处理：
     * 90度和270度使用近似的大数值
     */
    TAN_TABLE: [
        0, 1143, 2290, 3446, 4615, 5799, 7002, 8230, 9490, 10787, 12131, 13535, 15008, 16568, 18236, 20032,
        21983, 24119, 26479, 29113, 32094, 35511, 39486, 44183, 49822, 56709, 65536, 76817, 91755, 112651, 143008, 190650,
        6553600, -190650, -143008, -112651, -91755, -76817, -65536, -56709, -49822, -44183, -39486, -35511, -32094, -29113, -26479, -24119,
        -21983, -20032, -18236, -16568, -15008, -13535, -12131, -10787, -9490, -8230, -7002, -5799, -4615, -3446, -2290, -1143,
        0, 1143, 2290, 3446, 4615, 5799, 7002, 8230, 9490, 10787, 12131, 13535, 15008, 16568, 18236, 20032,
        21983, 24119, 26479, 29113, 32094, 35511, 39486, 44183, 49822, 56709, 65536, 76817, 91755, 112651, 143008, 190650,
        6553600, -190650, -143008, -112651, -91755, -76817, -65536, -56709, -49822, -44183, -39486, -35511, -32094, -29113, -26479, -24119,
        -21983, -20032, -18236, -16568, -15008, -13535, -12131, -10787, -9490, -8230, -7002, -5799, -4615, -3446, -2290, -1143,
        0, 1143, 2290, 3446, 4615, 5799, 7002, 8230, 9490, 10787, 12131, 13535, 15008, 16568, 18236, 20032,
        21983, 24119, 26479, 29113, 32094, 35511, 39486, 44183, 49822, 56709, 65536, 76817, 91755, 112651, 143008, 190650,
        6553600, -190650, -143008, -112651, -91755, -76817, -65536, -56709, -49822, -44183, -39486, -35511, -32094, -29113, -26479, -24119,
        -21983, -20032, -18236, -16568, -15008, -13535, -12131, -10787, -9490, -8230, -7002, -5799, -4615, -3446, -2290, -1143,
        0, 1143, 2290, 3446, 4615, 5799, 7002, 8230, 9490, 10787, 12131, 13535, 15008, 16568, 18236, 20032,
        21983, 24119, 26479, 29113, 32094, 35511, 39486, 44183, 49822, 56709, 65536, 76817, 91755, 112651, 143008, 190650,
        6553600, -190650, -143008, -112651, -91755, -76817, -65536, -56709, -49822, -44183, -39486, -35511, -32094, -29113, -26479, -24119
    ],

    /**
     * 反正弦查找表 - 从-1到1之间的200个值
     * 16位定点数格式存储，减少表大小以提高性能
     */
    ASIN_TABLE: [
        -102944, -101538, -100132, -98716, -97312, -95894, -94488, -93068, -91648, -90228,
        -88820, -87400, -85992, -84568, -83152, -81736, -80320, -78904, -77488, -76072,
        -74644, -73228, -71812, -70384, -68968, -67540, -66124, -64696, -63280, -61852,
        -60436, -59008, -57592, -56164, -54748, -53320, -51904, -50476, -49060, -47632,
        -46216, -44788, -43372, -41944, -40528, -39100, -37684, -36256, -34840, -33400,
        -31996, -30568, -29140, -27724, -26296, -24868, -23440, -22012, -20596, -19168,
        -17740, -16312, -14896, -13468, -12040, -10612, -9184, -7756, -6328, -4900,
        -3472, -2056, -628, 788, 2216, 3644, 5072, 6500, 7928, 9356,
        10784, 12212, 13640, 15068, 16496, 17924, 19352, 20780, 22208, 23636,
        25064, 26492, 27920, 29348, 30776, 32204, 33632, 35060, 36488, 37916,
        39344, 40772, 42200, 43628, 45056, 46484, 47912, 49340, 50768, 52196,
        53624, 55052, 56480, 57908, 59336, 60764, 62192, 63620, 65048, 66476,
        67904, 69332, 70760, 72188, 73616, 75044, 76472, 77900, 79328, 80756,
        82184, 83612, 85040, 86468, 87896, 89324, 90752, 92180, 93608, 95036,
        96464, 97892, 99320, 100748, 102176, 103604
    ],

    /**
     * 反余弦查找表 - 从-1到1之间的200个值
     * 16位定点数格式存储，减少表大小以提高性能
     */
    ACOS_TABLE: [
        205888, 204480, 203076, 201660, 200256, 198840, 197436, 196020, 194604, 193176,
        191768, 190352, 188936, 187520, 186104, 184688, 183272, 181856, 180440, 179024,
        177608, 176192, 174764, 173348, 171932, 170516, 169100, 167684, 166268, 164852,
        163436, 162008, 160592, 159176, 157760, 156344, 154928, 153512, 152096, 150680,
        149264, 147836, 146420, 145004, 143588, 142172, 140756, 139340, 137924, 136508,
        135092, 133664, 132248, 130832, 129416, 128000, 126584, 125168, 123752, 122324,
        120908, 119492, 118076, 116660, 115244, 113828, 112412, 110996, 109568, 108152,
        106736, 105320, 103904, 102488, 101072, 99656, 98240, 96824, 95408, 93980,
        92564, 91148, 89732, 88316, 86900, 85484, 84068, 82652, 81224, 79808,
        78392, 76976, 75560, 74144, 72728, 71312, 69896, 68480, 67064, 65636,
        64220, 62804, 61388, 59972, 58556, 57140, 55724, 54296, 52880, 51464,
        50048, 48632, 47216, 45800, 44384, 42968, 41552, 40136, 38720, 37292,
        35876, 34460, 33044, 31628, 30212, 28796, 27380, 25964, 24548, 23132,
        21716, 20300, 18884, 17468, 16052, 14636, 13220, 11804, 10388, 8972,
        7556, 6140, 4724, 3308, 1892, 0
    ],

    /**
     * 常量
     */
    CONSTANTS: {
        PI: 205887,          // π (3.14159...)
        TWO_PI: 411774,      // 2π
        HALF_PI: 102944,     // π/2
        NEG_PI: -205887,     // -π
        NEG_HALF_PI: -102944,// -π/2
        ONE: 65536,          // 1.0
        ZERO: 0,             // 0.0
        HALF: 32768,         // 0.5
        E: 178144           // 自然对数的底 e (2.71828...)
    }
}; 